#pragma once

#include "WSHeaders.h"

#define WS_NS_CORE_BEGIN	namespace WuShuang { namespace Core {
#define WS_NS_CORE_END		}}
#define WS_USING_NS_CORE	using namespace WuShuang::Core;

////////////////////////////////////////////////////

typedef unsigned char BYTE;

////////////////////////////////////////////////////


#define WSGetProperty(type, name) \
	inline virtual type Get##name() { return _##name; }

#define WSSetProperty(type, name) \
	inline virtual void Set##name(type value) { _##name = value; }

#define WSGetPtrProperty(type, name) \
	inline virtual type Get##name() { return _p##name; }

#define WSSetPtrProperty(type, name) \
	inline virtual void Set##name(type value) { _p##name = value; }

#define WSProperty(type, name) \
	protected:\
		type _##name;\
	public:\
		WSGetProperty(type, name); \
		WSSetProperty(type, name);

#define WSPtrProperty(type, name) \
	protected:\
		type* _p##name;\
	public:\
		WSGetPtrProperty(type*, name); \
		WSSetPtrProperty(type*, name);

#define WSReadOnlyProperty(type, name) \
	protected:\
		type _##name;\
	public:\
		WSGetProperty(const type&, name);

////////////////////////////////////////////////////

#define FOREACH_ARRAY(type, var)\
	type::Iterator __end__ = var.End();\
	for (type::Iterator it = var.Begin(); it != __end__; ++it)

#define FOREACH_SET(type, var)\
	type::Iterator __end__ = var.End();\
	for (type::Iterator it = var.Begin(); it != __end__; ++it)

////////////////////////////////////////////////////
#define SAFE_DELETE(p) if ((p)) { delete[] (p); p = NULL; }

////////////////////////////////////////////////////
#if defined(_WSLIB)
	#define WS_DLL  __declspec(dllexport)
#else
	#define WS_DLL	__declspec(dllimport)
#endif
